package com.wayhome.srpingbootmybatis.placeCloud.controller;

import com.alibaba.excel.EasyExcel;
import com.wayhome.srpingbootmybatis.placeCloud.dto.ImportPlaceData;
import com.wayhome.srpingbootmybatis.placeCloud.dto.PlaceCloudPharCfgDTO;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;

public class QuyupingtaiCnf {

    private static String split = "','";

    public static void main(String[] args) throws Exception {
        QuyupingtaiCnfLister quyupingtaiCnfLister = new QuyupingtaiCnfLister();

        File file = new File("/Users/liangcai/Desktop/shenwei-cnf.xlsx");
        InputStream inputStream = new FileInputStream(file);
        EasyExcel.read(inputStream, PlaceCloudPharCfgDTO.class, quyupingtaiCnfLister).sheet().doRead();

        List<PlaceCloudPharCfgDTO> list = quyupingtaiCnfLister.getList();
        for (PlaceCloudPharCfgDTO placeCloudPharCfgDTO : list) {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("insert into hibiz_db.place_cloud_phar_cfg(")
                    .append("FIXMEDINS_CODE,")// 机构编码
                    .append("ORG_APP_ID,")// 医院调用平台appid
                    .append("ORG_APP_SECRET,")//医院调用平台appsecret
                    .append("PLATFORM_APP_ID,")//平台调用医院appid
                    .append("PLATFORM_APP_SECRET,")//平台调用医院appsecret
                    .append("ORG_PRIVATE_KEY,")//定点机构私匙
                    .append("ORG_PUB_KEY) value('");//平台公匙

            stringBuilder.append(placeCloudPharCfgDTO.getFixmedinsCode()).append(split);
            stringBuilder.append(placeCloudPharCfgDTO.getOrgAppId()).append(split);
            stringBuilder.append(placeCloudPharCfgDTO.getOrgAppSecret()).append(split);
            stringBuilder.append(placeCloudPharCfgDTO.getPlatformAppId()).append(split);
            stringBuilder.append(placeCloudPharCfgDTO.getPlatformAppSecret()).append(split);
            stringBuilder.append(placeCloudPharCfgDTO.getOrgPrivateKey()).append(split);
            stringBuilder.append(placeCloudPharCfgDTO.getPlatformPubKey()).append("');");

            System.out.println(stringBuilder.toString());
        }
    }
}
